﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BoneImp {
	abstract class BaseTimeline : CurveTimeline {
		protected const int TRANSLATE_LAST_FRAME_TIME = -3;
		protected const int TRANSLATE_FRAME_X = 1;
		protected const int TRANSLATE_FRAME_Y = 2;

		protected int framesLength;
		protected float[] frames; /* time, angle, ... for rotate. time, x, y, ... for translate and scale. */
		public int boneIndex;

		/* Many timelines have structure identical to struct BaseTimeline and extend CurveTimeline. **/
		public BaseTimeline(int frameCount, int frameSize) : base(frameCount) {
			this.framesLength = frameCount * frameSize;
			this.frames = new float[this.framesLength];
		}

		public void setFrame(int frameIndex, float time, float x, float y) {
			frameIndex *= 3;
			this.frames[frameIndex] = time;
			this.frames[frameIndex + 1] = x;
			this.frames[frameIndex + 2] = y;
		}
	}
}
